<template>
  <div class="yzh-basic" v-if="formData">
    <el-descriptions title="基本信息" :column="2" border>
      <template #title>
        <TitleName title="基本信息" icon="i-carbon-bookmark-filled"></TitleName>
      </template>
      <el-descriptions-item
        label="订单"
        label-align="right"
        label-class-name="w-3/24"
        class-name="w-9/24"
        >{{ formData.title }}</el-descriptions-item
      >
      <!-- <el-descriptions-item
        label="供应商"
        label-align="right"
        label-class-name="w-3/24"
      >
        <el-link
          type="primary"
          :underline="false"
          @click="
            goTo('/source/sourceModules/supplierDetails', {
              supplierId: formData.customerId
            })
          "
          >{{ formData.customerName }}</el-link
        ></el-descriptions-item
      > -->
      <el-descriptions-item
        label="订单总金额(元)"
        label-align="right"
        label-class-name="w-3/24"
        >{{ formData.price }}</el-descriptions-item
      >
      <el-descriptions-item label="产品记录" label-align="right">
        {{ formData.productNum }}条
      </el-descriptions-item>
      <el-descriptions-item label="状态" label-align="right">
        <dict-drop
          :options="order_status"
          :value="formData.status"
          :isDrop="false"
      /></el-descriptions-item>
      <el-descriptions-item label="关联项目" label-align="right">
        <el-link
          type="primary"
          :underline="false"
          @click="
            goTo('/sales/projectManage/projectDetails', {
              id: formData.projectId
            })
          "
          >{{ formData.projectName }}</el-link
        ></el-descriptions-item
      >
      <el-descriptions-item label="业务板块" label-align="right">
        <dict-drop
          :options="order_business_type"
          :value="formData.businessType"
          :isDrop="false"
      /></el-descriptions-item>
      <el-descriptions-item label="关联合同" label-align="right">
        <el-link
          type="primary"
          :underline="false"
          @click="
            goTo('/sales/contract/contractDetail', {
              id: formData.contractId
            })
          "
          >{{ formData.contractName }}</el-link
        >
      </el-descriptions-item>
      <el-descriptions-item label="所属单位" label-align="right">{{
        formData.deptName
      }}</el-descriptions-item>
      <el-descriptions-item label="业务部门" label-align="right">{{
        formData.transactionDeptName
      }}</el-descriptions-item>
      <!-- <el-descriptions-item label="签单日期" label-align="right">{{
        formData.orderBelongDeptName
      }}</el-descriptions-item> -->
      <el-descriptions-item label="业务员" label-align="right">{{
        formData.transactionName
      }}</el-descriptions-item>
      <el-descriptions-item label="备注信息" label-align="right">{{
        formData.remark
      }}</el-descriptions-item>
    </el-descriptions>
    <el-descriptions title="付款信息" :column="2" border>
      <template #title>
        <TitleName
          title="付款信息"
          icon="i-carbon-bookmark-filled"
          class="pt-6"
        ></TitleName>
      </template>
      <el-descriptions-item
        label="付款计划"
        label-align="right"
        label-class-name="w-3/24"
        class-name="w-9/24"
        >{{ formData.allPeriod }}期</el-descriptions-item
      >
      <el-descriptions-item
        label="付款截止日期"
        label-align="right"
        label-class-name="w-3/24"
        >{{
          parseTime(formData.repaymentDeadline, '{y}-{m}-{d}')
        }}</el-descriptions-item
      >
      <el-descriptions-item label="已完成计划" label-align="right"
        >{{ formData.donePlan }}期</el-descriptions-item
      >
      <el-descriptions-item label="已逾期计划" label-align="right">
        {{ formData.overduePlan }}期
      </el-descriptions-item>
      <el-descriptions-item label="已付款金额(元)" label-align="right">
        {{ formData.repaymentPrice }}</el-descriptions-item
      >
      <el-descriptions-item label="未付款金额(元)" label-align="right">{{
        formData.unRepaymentPrice
      }}</el-descriptions-item>
      <el-descriptions-item label="已开票金额(元)" label-align="right">
        {{ formData.invoicedPrice }}</el-descriptions-item
      >
      <el-descriptions-item label="未开票金额(元)" label-align="right">{{
        formData.unInvoicePrice
      }}</el-descriptions-item>
    </el-descriptions>
    <el-descriptions title="系统信息" :column="2" border>
      <template #title>
        <TitleName
          title="系统信息"
          icon="i-carbon-bookmark-filled"
          class="pt-6"
        ></TitleName>
      </template>
      <el-descriptions-item
        label="系统编号"
        label-align="right"
        label-class-name="w-3/24"
        class-name="w-9/24"
        >{{ formData.number }}</el-descriptions-item
      >
      <el-descriptions-item
        label="协作人员"
        label-align="right"
        label-class-name="w-3/24"
        >{{ formData.assistUserName }}</el-descriptions-item
      >
      <el-descriptions-item label="创建时间" label-align="right">{{
        parseTime(formData.createTime, '{y}-{m}-{d}')
      }}</el-descriptions-item>
      <el-descriptions-item label="创建人员" label-align="right">
        {{ formData.createName }}
      </el-descriptions-item>
      <el-descriptions-item label="更新时间" label-align="right">
        {{
          parseTime(formData.updateTime, '{y}-{m}-{d}')
        }}</el-descriptions-item
      >
      <!-- <el-descriptions-item label="最后跟进时间" label-align="right">{{
        parseTime(formData.followTime, '{y}-{m}-{d}')
      }}</el-descriptions-item> -->
    </el-descriptions>
  </div>
</template>
<script setup name="Overview">
import { reactive, toRefs, ref } from 'vue'
import { useRouter, useRoute } from 'vue-router'
import useCommonStore from '@/store/modules/common'
import {
  order_business_type, //订单业务分类
  order_status //订单状态
} from '@/hooks/dict/order'
import { getSalesOrderDetail } from '@/api/indentManage/indent'
const router = useRouter()
const route = useRoute()
const props = defineProps({
  orderData: {
    type: Object,
    require: true
  }
})
const { proxy } = getCurrentInstance()
const commonStore = useCommonStore()
const sortOptions = ref([])
const companyData = ref([])
commonStore.getCompanyData().then(e => {
  companyData.value = e
})
const data = reactive({
  formData: {}
})
let { formData } = toRefs(data)

watchEffect(() => {
  if (props.orderData) {
    formData.value = props.orderData
  }
})

function goTo(url, data) {
  router.push({ path: url, query: data })
}
</script>
<style lang="scss" scoped></style>
